package cn.tedu;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class demo02 {
    public static void main(String[] args) throws SQLException {
        //1.得到连接对象
        Connection con = DriverManager.getConnection(
                "jdbc:mysql://localhost:3306/empdb?" +
                        "characterEncoding=utf8&serverTimezone=Asia/Shanghai",
                "root",
                "root");
        System.out.println("创建连接对象成功2");
        //2.得到执行SQL的对象
        Statement s = con.createStatement();
        System.out.println("得到执行SQL语句的对象2");
        //3.执行SQL语句
        s.execute("drop table jdbc2");
        //4.关闭资源
        con.close();
        System.out.println("关闭资源完毕2");
    }
}
